<?php

namespace App\Http\Controllers;

use App\User;
use App\Http\Requests\UserRequest;
use Illuminate\Support\Facades\Hash;

class UserController extends Controller
{
    /**
     * Display a listing of the users
     *
     * @param  \App\User  $model
     * @return \Illuminate\View\View
     */
    public function index(User $user)
    {
        return view('pages.users', ['users' => $user->paginate(15)]);
    }

    public function update($id)
    {
        $status = User::find($id)->status == 0 ? 1 : 0 ;
        User::find($id)->update(['status' => $status]);
        return back()->withStatus(__('变更用户状态成功'));
    }
}
